barph
Strings Timm Mar10 Revised

Print a String to Standard Error

Problem
========

While converting input to output, it is often
useful to print notices to a third stream. 
For example, on error cases, it is standard
to print to the UNIX standard error stream.

Solution
========

warning
-------

The _warning_ function prints to standard error. 

 function warning(str,    exitCode) {
     exitCode = exitCode ? exitCode : 1
     print "#"Program" warning: " str   >> "/dev/stderr";
     fflush("/dev/stderr");
	 Patience--
	 if (Patience == 0) 
	 	exit exitCode
 }

_Program_ is an optional string that is prepended to each warning.

_Patience_ is an optional error counter. If set, then it ever gets to zero then we run
out of patience and exit. If not set, then _Patience--_ will send it negative so it will
never be zero so we never run out of patience.

barph
-----

The _barph_ function prints to standard error and
returns a non-zero error status.

 function barph(str,  exitCode) {
     exitCode = exitCode ? exitCode : 1
     warning(str,   exitCode)
     exit exitCode; 
 }

ok
--

The _ok function checks some code, and calls _barph_
if it is non-zero.

 function ok(status,warning,    exitCode) {
	if (!status)
	  barph(warning,exitCode)
 }

The _notOk_ function checks some code, and calls _barph_
if it is non-zero.

notOk
-----

 function notOk(status,warning,    exitCode) {
	if (status)
	  barph(warning,exitCode)
 }

Author
======

Tim Menzies

